package com.treasure.mall.zbq.common.ienum.marketing;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.treasure.mall.zbq.common.constant.Constant;
import com.treasure.mall.zbq.common.ienum.base.CodeDescCommonEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/8/1
 */
public interface RedPacketEnums {
    @Getter
    @AllArgsConstructor
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    enum Type implements CodeDescCommonEnum {
        NORMAL(0, "普通红包"),
        RANDOM(1, "随机红包");

        private final Integer code;
        private final String desc;
    }

    @Getter
    @AllArgsConstructor
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    enum Status implements CodeDescCommonEnum {
        TO_GRAB(0, "未开抢"),
        GRABBING(1, "已开抢"),
        COMPLETE(2, "已抢完"),
        CANCEL(3, "已回收");

        private final Integer code;
        private final String desc;

        public String statusClass() {
            switch (this) {
                case TO_GRAB:
                case CANCEL:
                    return Constant.COLOR_DANGER;
                case GRABBING:
                    return Constant.COLOR_WARNING;
                default:
                    return Constant.COLOR_PRIMARY;
            }
        }
    }
}
